<?php
/**
 * User: yimudi
 * Email: aphie1900@sina.com
 * Date & Time: 2017/9/7 17:39
 */

namespace app\api\model;


class Banner extends BaseModel
{
    protected $hidden = ['update_time', 'delete_time'];

    public function items()
    {
        return $this->hasMany('BannerItem', 'banner_id', 'id');
    }

    /**
     * @param $id
     * @return mixed
     */
    public static function getBannerByID($id)
    {
        $res = self::with(['items', 'items.img'])->find($id);
        return $res;
    }
}